home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / var / lib / dpkg / info / bluez.preinst < prev    next >
Encoding:
Text File  |  2009-04-24  |  2.1 KB  |  65 lines

  1. #!/bin/sh
  2.  
  3. # snippet from http://www.dpkg.org/dpkg/ConffileHandling
  4.  
  5. # Prepare to move a conffile without triggering a dpkg question
  6. prep_mv_conffile() {
  7.     CONFFILE="$1"
  8.  
  9.     if [ -e "$CONFFILE" ]; then
  10.         md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
  11.         old_md5sum="`sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' $CONFFILE'{s/.* //;p}}\" /var/lib/dpkg/status`"
  12.         if [ "$md5sum" = "$old_md5sum" ]; then
  13.             rm -f "$CONFFILE"
  14.         fi
  15.     fi
  16. }
  17.  
  18. # Remove a no-longer used conffile
  19. rm_conffile() {
  20.     PKGNAME="$1"
  21.     CONFFILE="$2"
  22.     if [ -e "$CONFFILE" ]; then
  23.         md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
  24.         old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE '{s/ obsolete$//;s/.* //p}\"`"
  25.         if [ "$md5sum" != "$old_md5sum" ]; then
  26.             echo "Obsolete conffile $CONFFILE has been modified by you."
  27.             echo "Saving as $CONFFILE.dpkg-bak ..."
  28.             mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
  29.         else
  30.             echo "Removing obsolete conffile $CONFFILE ..."
  31.             rm -f "$CONFFILE"
  32.         fi
  33.     fi
  34. }
  35.  
  36. case "$1" in
  37. install|upgrade)
  38.     #if dpkg --compare-versions "$2" le "2.19-1"; then
  39.     #   prep_mv_conffile "/etc/init.d/bluez-utils"
  40.     #   prep_mv_conffile "/etc/default/bluez-utils"
  41.     #fi
  42.  
  43.     if dpkg --compare-versions "$2" le "3.7-1"; then
  44.         prep_mv_conffile "/etc/dbus-1/system.d/bluez-hcid.conf"
  45.     fi
  46.  
  47.     if dpkg --compare-versions "$2" le "3.30-1"; then
  48.         rm_conffile bluez-utils "/etc/bluetooth/network.service"
  49.         rm_conffile bluez-utils "/etc/bluetooth/serial.service"
  50.         rm_conffile bluez-utils "/etc/bluetooth/input.service"
  51.     fi
  52.  
  53.     if dpkg --compare-versions "$2" lt "4.25-0ubuntu2"; then
  54.     if [ -e "/etc/udev/rules.d/62-bluez-hid2hci.rules" ]; then
  55.         if [ "`md5sum \"/etc/udev/rules.d/62-bluez-hid2hci.rules\" | sed -e \"s/ .*//\"`" = \
  56.              "`dpkg-query -W -f='${Conffiles}' bluez | sed -n -e \"\\\\' /etc/udev/rules.d/62-bluez-hid2hci.rules's/.* //p\"`" ]
  57.         then
  58.             rm -f "/etc/udev/rules.d/62-bluez-hid2hci.rules"
  59.         fi
  60.     fi
  61.     fi
  62. esac
  63.  
  64.  
  65.